package com.bluestone.obsidian.jna;

import com.sun.jna.Library;
import com.sun.jna.Native;
import com.sun.jna.Platform;

public class JnaHelloWorld {
	public interface CLibrary extends Library{
		//定义并初始化接口的静态变量
		CLibrary Instance=(CLibrary)Native.loadLibrary((Platform.isWindows()?"msvcrt":"c"),CLibrary.class);
		
		//printf函数声明
        void printf(String format, Object... args);
	}
	
	public interface HsComm extends Library{
		//定义并初始化接口的静态变量
		HsComm Instance=(HsComm)Native.loadLibrary(("HsCommX.dll"),HsComm.class);
		
        void setConnect();
	}
	
	public static void main(String[] args) {
		CLibrary.Instance.printf("Hello,JNI","hi");
		HsComm.Instance.setConnect();
	}
}
